#!/bin/bash

test_arr[0]=1;
test_arr[1]=2;
test_arr[2]=3;
test_arr[3]=4;
test_arr[4]="index_4";
test_arr[5]="inde_5";

echo ${test_arr[0]};
echo ${test_arr[1]};
echo ${test_arr[2]};

index3=3;
echo ${test_arr[${index3}]};
index4=4;
echo ${test_arr[${index4}]};
index5=5;
echo ${test_arr[${index5}]};

#以清单的形式打印出数组中所有的值
echo ${test_arr[*]};
echo ${test_arr[@]};

#打印数组长度
echo ${#test_arr[*]};
#打印数组value的长度
echo ${#test_arr[0]};